package cn.edu.scau.cmi.linpeiwei.multiton;

import java.util.HashSet;
import java.util.Set;

public class Marshal {
	private static Set<Marshal> marshals = new HashSet<>();
	private String name;
	
	private  Marshal(String name) {
		this.name = name;
	}
	public static Set<Marshal> getMarshal(String name) {
		if(marshals.size()<10)
			marshals.add(new Marshal(name));
		else 
			System.out.println("加入失败,人数超过10个");
		return marshals;
	}
	public String getName(){
		return name;
	}
}
